<template>
    <div>
        <div class="zuo" style="float: left;">
            <van-sidebar v-model="active">
                <van-sidebar-item v-for="i in fldata" :title="i.cat_name" />
            </van-sidebar>
        </div>
        <div class="you" >
            <div v-for="item in fldata[active]?.children">
                <h4>{{ item.cat_name }}</h4>
                <div>
                    <van-grid :border="false" :column-num="3">
                        <van-grid-item v-for="ii in item.children">
                            <van-image :src="ii.cat_icon" @click="tz(ii.cat_id)"/>
                        </van-grid-item>
                    </van-grid>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>

import { ref } from 'vue';
import { fl } from '@/api/api';
import { useRouter } from 'vue-router';
const router=new useRouter()
const active = ref(0);
const fldata = ref([])
fl().then(res => {
    console.log('分类', res)
    fldata.value = res.data.message
})
let tz=(id)=>{
    console.log('id',id)
    router.push('/erji')
}
</script>

<style lang="scss" scoped></style>